package com.sprucetec.live.common.webcontext;

import com.sprucetec.live.base.entity.User;

/**
 * Created with IntelliJ IDEA.
 * User: zhangyb
 * Date: 2018/11/1
 * Time: 15:59
 * Description:
 **/
public class LoginUserContext {

    private static ThreadLocal<User> loginUser = new ThreadLocal<>();


    public static void setUser(User user) {
        loginUser.remove();
        loginUser.set(user);
    }

    public static User getUser() {
        return loginUser.get();
    }

    public static void delete() {
        loginUser.remove();
    }
}
